//
//  GGMatchesActivityCell.swift
//  DongBaoDemo
//
//  Created by 陈志勇 on 2018/8/4.
//  Copyright © 2018年 陈志勇. All rights reserved.
//

import UIKit
import Kingfisher

class GGMatchesActivityCell: UITableViewCell {

    @IBOutlet weak var stateImageView: UIImageView!
    @IBOutlet weak var imagBannerView: UIImageView!
    @IBOutlet weak var nameLabel: UILabel!
    @IBOutlet weak var addressLabel: UILabel!
    
    var race: Race? {
        didSet {
            guard let race = race else {
                return
            }
            
            nameLabel.text = race.name
            addressLabel.text = race.address
            let url = "http://football.dooksport.com" + race.image_banner!
            imagBannerView.kf.setImage(with: URL(string: url), placeholder: #imageLiteral(resourceName: "ad"))
            
            if let state = race.status {
                switch state {
                    
                case .enroll:
                    stateImageView.image = #imageLiteral(resourceName: "bmz")
                case .race:
                    stateImageView.image = #imageLiteral(resourceName: "bsz")
                case .over:
                    stateImageView.image = #imageLiteral(resourceName: "yjs")
                }
            }
        }
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
